package net.kong.sns.rest.client;

/**
 * @author <a href="mailto:lanhuai@gmail.com">Ning Yubin</a>
 * @version $Id: AuthorizationHeader.java,v 1.2 2009/08/04 06:06:32 ningyubin Exp $
 */
public class AuthorizationHeader {
    private String realm = "KK-SNS Service";
    private String sessionKey;
    private String apiKey;
    private String signatureMethod = "Simple-MD5";
    private String signature;
    private String timestamp;
    private String nonce;
    private String version = "1.0";

    public AuthorizationHeader(String sessionKey) {
        this.sessionKey = sessionKey;
    }

    public void setRealm(String realm) {
        this.realm = realm;
    }

    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }

    public void setApiKey(String apiKey) {
        this.apiKey = apiKey;
    }

    public void setSignatureMethod(String signatureMethod) {
        this.signatureMethod = signatureMethod;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public void setNonce(String nonce) {
        this.nonce = nonce;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getRealm() {
        return realm;
    }

    public String getSessionKey() {
        return sessionKey;
    }

    public String getApiKey() {
        return apiKey;
    }

    public String getSignatureMethod() {
        return signatureMethod;
    }

    public String getSignature() {
        return signature;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public String getNonce() {
        return nonce;
    }

    public String getVersion() {
        return version;
    }

    @Override
    public String toString() {
        return "KAuth " +
                "realm=\"" + realm + '\"' +
                ", session_key=\"" + (sessionKey == null ? "" : sessionKey) + '\"' +
                ", api_key=\"" + apiKey + '\"' +
                ", kauth_signature_method=\"" + signatureMethod + '\"' +
                ", kauth_signature=\"" + signature + '\"' +
                ", kauth_timestamp=\"" + timestamp + '\"' +
                ", kauth_nonce=\"" + nonce + '\"' +
                ", kauth_version=\"" + version + '\"' +
                "";
    }
}
